<html>
<head><meta charset="utf-8"><title>why cache .cargo/bin/ ? · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/why.20cache.20.2Ecargo.2Fbin.2F.20.3F.html">why cache .cargo/bin/ ?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="213296704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/why%20cache%20.cargo/bin/%20%3F/near/213296704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/why.20cache.20.2Ecargo.2Fbin.2F.20.3F.html#213296704">(Oct 14 2020 at 14:31)</a>:</h4>
<p>The book recommends cashing <code>.cargo/bin/</code><br>
<a href="https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci">https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci</a><br>
but I think that is just files that are put there by the install of Rust. So why copy them to a CI cache? Does someone know why?</p>



<a name="213296951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/why%20cache%20.cargo/bin/%20%3F/near/213296951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/why.20cache.20.2Ecargo.2Fbin.2F.20.3F.html#213296951">(Oct 14 2020 at 14:32)</a>:</h4>
<p><code>cargo install</code> installs binaries to <code>~/.cargo/bin</code>.</p>



<a name="213297973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/why%20cache%20.cargo/bin/%20%3F/near/213297973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/why.20cache.20.2Ecargo.2Fbin.2F.20.3F.html#213297973">(Oct 14 2020 at 14:38)</a>:</h4>
<p>So no need if you don't use <code>cargo install</code> in your CI.<br>
And if you do then you also need <code>~/.cargo/.crates.toml</code> and/or <code>~/.cargo/.crates2.json</code> to avoid the reinstall.</p>



<a name="213301732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/why%20cache%20.cargo/bin/%20%3F/near/213301732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/why.20cache.20.2Ecargo.2Fbin.2F.20.3F.html#213301732">(Oct 14 2020 at 15:01)</a>:</h4>
<p>You could install binary to other place with <code>--root</code>, like <code>cargo install --root ~/.cargo/ci &lt;foo&gt;</code> then prepend <code>~/.cargo/ci/bin</code> to PATH.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>